<template>
  <div>
    <el-button @click="tempDownHandle()" size="small" type="primary">模板下载</el-button>
    <div style="margin-top:20px;"></div>
    <importFile :title="'导入'" :actionUrl="urls" @close="closeHandler" />
    <div style="height:47px;"></div>
    <div
      :style="{
        position: 'absolute',
        left: 0,
        bottom: 0,
        right: 0,
        zIndex: 9,
        borderTop: '1px solid #e9e9e9',
        padding: '10px 20px',
        background: '#fff',
        textAlign: 'right'
      }"
    ></div>
  </div>
</template>
<script>
import moment from 'moment';
import { downloadUrl } from '@/utils';
export default {
  props: ['importData'],
  data() {
    return {
      urls: this.importData.importUrl || '',
      fetchParams: {},
      fetchApi: () => {}
    };
  },
  methods: {
    tempDownHandle() {
      this.$confirm('是否将Excel表格保存至本地文件夹?', '提示', {
        confirmButtonText: '下载',
        cancelButtonText: '取消',
        type: 'warning'
      })
        .then(() => {
          downloadUrl('https://arcfox-serviceplatform.oss-cn-beijing.aliyuncs.com/虚拟车管理导入模板.xlsx', '虚拟车管理导入模板');
        })
        .catch(() => {
          this.$message({
            type: 'info',
            message: '已取消'
          });
        });
    },
    closeHandler() {
      this.$emit('close', false, 'refresh');
    }
  }
};
</script>
